/*
** my_strcpy.c for my_strcpy in /home/lingla_j/work/projet/pushswap
** 
** Made by julien linglain
** Login   <lingla_j@epitech.net>
** 
** Started on  Sat Jan  7 14:06:06 2012 julien linglain
** Last update Fri Mar 30 14:39:08 2012 julien linglain
*/

#include <stdlib.h>
#include <stdio.h>
#include "mysh.h"

void	my_putstr(char *str)
{
  xwrite(1, str, my_strlen(str));
}

void	my_puterror(char *str)
{
 xwrite(2, str, my_strlen(str));
}

char	*get_value(char *from)
{
  int	i;
  int	j;
  char	*to;

  i = 0;
  j = 0;
  while (from[i] != '=')
    i++;
  to = xmalloc(my_strlen(from) - i + 1);
  i++;
  while (from[i] != '\0')
    {
      to[j] = from[i];
      i++;
      j++;
    }
  to[j] = '\0';
  return (to);
}

char	*get_key(char *from)
{
  int	i;
  char	*to;

  i = 0;
  while (from[i] != '=')
    i++;
  to = xmalloc(i + 1);
  i = 0;
  while (from[i] != '=')
    {
      to[i] = from[i];
      i++;
    }
  to[i] = '\0';
  return (to);
}

char	*my_strcpy(char *from)
{
  int	i;
  char	*to;

  i = 0;
  to = xmalloc(my_strlen(from) + 1);
  while (from[i] != '\0')
    {
      to[i] = from[i];
      i++;
    }
  to[i] = '\0';
  return (to);
}
